package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.dto.ClazzQueryDto;
import com.itheima.pojo.Clazz;
import com.itheima.vo.ClazzVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {
    //分页条件查询
    Page<ClazzVo> query(ClazzQueryDto dto);

    //删除班级
    @Delete("delete from clazz where id = #{id}")
    void delete(Integer id);

    //添加班级
    void insert(Clazz clazz);

    //根据id查询班级
    @Select("select * from clazz where id = #{id}")
    Clazz findById(Integer id);

    //修改班级
    void update(Clazz clazz);

    //查询所有班级
    @Select("select * from clazz order by update_time desc")
    List<Clazz> findAll();
}

